package com.hosever.designPattern.factoryMethod;

public class Test {
	public static void main(String[] args) {
		System.out.println("====1.工厂方法模式====");
		System.out.println("====工厂方法模式-静态工厂模式====");
		DemoInterface demoInterface = FactoryMethod.getInstanceStatic();
		System.out.println(demoInterface.show());//先输出I'm DemoInterfaceImpl
		DemoInterface demoInterface2 = FactoryMethod.getInstance2Static();
		System.out.println(demoInterface2.show());//instance
		
		System.out.println("====工厂方法模式-多个工厂模式====");
		FactoryMethod fm = new FactoryMethod();
		DemoInterface demoInterface3 = fm.produce("1");
		System.out.println(demoInterface3.show());
		
		System.out.println("====工厂方法模式-简单工厂模式====");
		DemoInterface demoInterface4 = fm.getInstance();
		System.out.println(demoInterface4.show());
		DemoInterface demoInterface5 = fm.getInstance2();
		System.out.println(demoInterface5.show());
	}
}
